﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Vtron.LEDCorrective.EDSDKWrapper;

namespace Vtron.LEDCorrective.Pages
{
    /// <summary>
    /// CameraParameters.xaml 的交互逻辑
    /// </summary>
    public partial class CameraParameters : UserControl
    {
        public CameraParameters()
        {
            InitializeComponent();

            Loaded += CameraParameters_Loaded;
        }

        void CameraParameters_Loaded(object sender, RoutedEventArgs e)
        {
            EDSDKHandler handler = EDSDKHandler.Instance;
            List<int> avList = handler.GetAVList();
            List<int> tvList = handler.GetTVList();

            foreach (int av in avList)
            {
                redAv_ComboBox.Items.Add(CameraValues.AV((uint)av));
                greenAv_ComboBox.Items.Add(CameraValues.AV((uint)av));
                blueAv_ComboBox.Items.Add(CameraValues.AV((uint)av));
            }

            foreach (int tv in tvList)
            {
                redTv_ComboBox.Items.Add(CameraValues.TV((uint)tv));
                greenTv_ComboBox.Items.Add(CameraValues.TV((uint)tv));
                blueTv_ComboBox.Items.Add(CameraValues.TV((uint)tv));
            }

            redAv_ComboBox.SelectedIndex = redAv_ComboBox.Items.IndexOf(CameraValues.AV(handler.GetAVSetting()));
            greenAv_ComboBox.SelectedIndex = greenAv_ComboBox.Items.IndexOf(CameraValues.AV(handler.GetAVSetting()));
            blueAv_ComboBox.SelectedIndex = blueAv_ComboBox.Items.IndexOf(CameraValues.AV(handler.GetAVSetting()));

            redTv_ComboBox.SelectedIndex = redTv_ComboBox.Items.IndexOf(CameraValues.TV(handler.GetTVSetting()));
            greenTv_ComboBox.SelectedIndex = greenTv_ComboBox.Items.IndexOf(CameraValues.TV(handler.GetTVSetting()));
            blueTv_ComboBox.SelectedIndex = blueTv_ComboBox.Items.IndexOf(CameraValues.TV(handler.GetTVSetting()));
        }
    }
}
